
local ESN_Hate = LibStub("AceAddon-3.0"):NewAddon("ESN_Hate", "AceEvent-3.0")

local zeit = 5 --Hier die Zeit zwischen zwei Anzeigen einstellen

local HateGuild = {
	["Nox Resurrexit"] = true, --Diese Zeile einfach kopieren und Nox Resurrexit durch andere Gilde ersetzen
}

local HateName = {
	["Noosle"] = true,
	["Fjalir"] = true,
	["Daskia"] = true,
	["Apocalypticá"] = true,
	["Loneraider"] = true,
	["Alistea"] = true,
	["Tragi"] = true,
	["Xarnas"] = true,
	["Nifle"] = true,
	["Tragol"] = true,
	["Darcangel"] = true,
	["Divâ"] = true,
	["Trìton"] = true,
	["Akru"] = true,
	["Erius"] = true,
	["Kázuko"] = true,
	["Carlos"] = true,
	["Persephoné"] = true,
	["Carlos"] = true, --Diese Zeile einfach kopieren und Carlos durch anderen Charakter ersetzen
}

function ESN_Hate:OnInitialize()
	self:RegisterEvent("UPDATE_MOUSEOVER_UNIT","Hate")
end

function ESN_Hate:Output(mname,mguild,typ)
local output = true
--[[	if (GetNumRaidMembers() > 0) then
		for i = 1, 40 do
			local name = GetRaidRosterInfo(i);
			if (name and (name ~= "")) then
				if name ~= mname then
					output = true
				else
					output = false
					break
				end
			end
		end
	elseif (GetNumPartyMembers() > 0) then
		for i = 1, 4 do
			local name = UnitName("party"..i);
			if (name and (name ~= "")) then
				if name ~= mname then
					output = true
				else
					output = false
					break
				end
			end
		end
	end]]--
	if UnitName("player") ~= mname and output then
		PlaySoundFile([[Interface\AddOns\ESN_Hate\Fun\alarm.wav]])
		if typ == "Guild" then
			UIErrorsFrame:AddMessage("Hass Gilde: "..mname.." von "..mguild, 1, 0, 0, 77, 3);
			DEFAULT_CHAT_FRAME:AddMessage("Hass Gilde: "..mname.." von "..mguild, 1.0, 0.0, 0.0);
		elseif typ == "Name" then
			UIErrorsFrame:AddMessage("Hass Person: "..mname, 1, 0, 0, 77, 3);
			DEFAULT_CHAT_FRAME:AddMessage("Hass Person: "..mname, 1.0, 0.0, 0.0);
		elseif typ == "Ignore" then
			UIErrorsFrame:AddMessage("Ignoriert: "..mname, 1, 0, 0, 77, 3);
			DEFAULT_CHAT_FRAME:AddMessage("Ignoriert: "..mname, 1.0, 0.0, 0.0);
		end
	end
end

function ESN_Hate:Hate()
local inInstance, instanceType = IsInInstance()
if instanceType == "party" or instanceType == "raid" then
-----nix
else
	if UnitExists("mouseover") then
		local mname = UnitName("mouseover")
		local mguild = GetGuildInfo("mouseover")
----------------------Guildlist
		for HGuild in pairs(HateGuild) do
			if HGuild == mguild and UnitExists("mouseover") then
				if self.t == nil or (GetTime() - self.t > zeit) then
					self.t = GetTime()
					ESN_Hate:Output(mname,mguild,"Guild")
				end	
			end
		end		
----------------------Namelist
		for HName in pairs(HateName) do
			if HName == mname and UnitExists("mouseover") then
				if self.t == nil or (GetTime() - self.t > zeit) then
					self.t = GetTime()
					ESN_Hate:Output(mname,mguild,"Name")
				end	
			end
		end
----------------------Ignorelist		
		for i=1, GetNumIgnores() do
			if GetIgnoreName(i) == mname and UnitExists("mouseover") then
				if self.t == nil or (GetTime() - self.t > zeit) then
					self.t = GetTime()
					ESN_Hate:Output(mname,mguild,"Ignore")
				end
			end
		end
	end
end
end
